//package com.zmn.plat.dubbo.controller;
//
//import com.zmn.common.dto2.ResponseDTO;
//import com.zmn.plat.business.interfaces.product.ProductDetailsBService;
//import com.zmn.plat.common.dto.product.ProductDIO;
//import com.zmn.plat.common.dto.product.base.ProductBaseDRO;
//import com.zmn.plat.dubbo.interfaces.product.ProductListRemoteService;
//import com.zmn.plat.dubbo.utils.DubboConsts;
//import com.zmn.plat.model.entity.category.BaseCategory;
//import com.zmn.plat.services.interfaces.category.BaseCategoryService;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.dubbo.config.annotation.Reference;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import java.util.Arrays;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.concurrent.TimeUnit;
//import java.util.stream.Collectors;
//
///**
// * 类描述：
// *
// * @author yangshuangping
// * @since 2021/11/12 18:03
// */
//@Slf4j
//@RestController
//@RequestMapping("/test/")
//public class testController {
//
//    @Reference(version = "2.0", check = false)
//    ProductListRemoteService productListRemoteService;
//    @Resource
//    ProductDetailsBService productDetailsBService;
//    @Resource
//    RedisTemplate<String, String> redisTemplate;
//    @Resource
//    BaseCategoryService baseCategoryService;
//
//    @RequestMapping(value = "listBaseDROByDIO", method = RequestMethod.POST)
//    public ResponseDTO test1(@RequestBody ProductDIO productDIO) {
////        productListRemoteService.listBaseDROByDIO(productDIO);
//        List<ProductBaseDRO> droList = productDetailsBService.listBaseDROByDIO(productDIO);
//        return ResponseDTO.success();
//    }
//
//    @RequestMapping(value = "redistest", method = RequestMethod.POST)
//    public void redistest() {
//        String key = "category";
//        List<BaseCategory> categoryListt = baseCategoryService.listAll();
//        Map<String, BaseCategory> categoryMap = new HashMap<>(categoryListt.size());
//        for (BaseCategory baseCategory : categoryListt) {
//            categoryMap.put(String.valueOf(baseCategory.getCategId()), baseCategory);
//        }
//        // 存储所有信息到redis
//        redisTemplate.opsForHash().putAll(key, categoryMap);
//        redisTemplate.expire(key, 1, TimeUnit.DAYS);
//        // 获取单个
//        BaseCategory category = (BaseCategory)redisTemplate.opsForHash().get(key, "1000");
//        // 获取多个
//        List<Object> list1 = redisTemplate.opsForHash().multiGet(key, Arrays.asList("1000", "1001", "1002"));
//        // 获取所有
//        List<Object> list2 = redisTemplate.opsForHash().values(key);
//        // 存单个
//        redisTemplate.opsForHash().put(key, "1000", category);
//        System.out.println(11);
//    }
//
//}
